@echo off
color 0E
setlocal
set curdir=%~dp0
cd /d %curdir%

echo test am i admin? > %SystemRoot%\System32\ThinkVenus.test
if not exist "%SystemRoot%\System32\ThinkVenus.test" (
    echo  Warning: please run as an administrator!
    pause
    exit
)
del %SystemRoot%\System32\ThinkVenus.test

rem Detects whether the java_home environment variable is defined
if not "%JAVA_HOME%" == "" goto foundJavaHome
echo WARNING: The operating system does not install the Java running environment, and begin to find java-home from installation package
for /f "delims=" %%i in ('dir /ad /b "%curdir%..\" ^| findstr "^jdk.*$"') do (
	set JAVA_HOME=%curdir%..\%%i
	goto foundJavaHome
)
echo WARNING: Can't find the java home.
pause
:foundJavaHome
echo USING JAVA_HOME: %JAVA_HOME%
set PATH=%JAVA_HOME%\bin;%PATH%
java -fullversion
keytool -export -alias "crm-app" -file "%curdir%crm-app.crt" -keystore "%curdir%nature.keystore"
pause 